<?php use_helper('I18N'); ?>
<style type="text/css">
    p img {
        background: none repeat scroll 0 0 white;
        border: 1px solid #BBBBBB;
        margin: 7px 14px 7px 0;
        padding: 5px;
        height: 50px;
        /*width: 160px;*/
    }
</style>
<script type="text/javascript">
    $(function() {
        $("#addToCart, #addToCart2").button({
            icons: {
                primary: "ui-icon-cart"
            }
        });
        $('.onlyNumeric').focus(function(){
            $(this).select();
        }).numeric({
            decimal:false
            , minValue:0
        });
    });
</script>
<div id="content">

<!-- ========== CATEGORIES TABS ========= -->
<!-- ==================================== -->
<table id="contentMainWrapper" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td id="column-left" style="width: 215px;">
    <div style="width:215px;">
        <!--// bof: categories //-->
        <div class="box" id="categories" style="width:215px;">
            <div class="box-border">
                <div class="box-head">
                    <?php echo __('Categories') ?>
                </div>
                <div class="box-body">
                    <?php include_component('component', 'categoriesSideMenu') ?>
                </div>
            </div>
        </div>
        <!--// eof: categories //-->
        <!--// bof: specials //-->
        <div class="box" id="specials" style="width:215px;">
            <div class="box-border">
                <div class="box-head">
                    <a href="<?php echo url_for("/product/specialItem") ?>"><?php echo __('Specials') ?></a>
                </div>
                <div class="box-body">
                    <?php include_component('component', 'specialsSideMenu', array('param' => 'will implement for categoryType')) ?>
                </div>

            </div>
        </div>
        <!--// eof: specials //-->
    </div>
</td>

<td id="column-center" valign="top">
    <div class="column-center-padding">
        <div class="centerColumn" id="indexProductList">

            <h1 id="productListHeading">Advance Search</h1>

            <form name="filterForm" action="/product/search">
                <table>
                    <tr>
                        <td valign="middle" style="vertical-align: middle;"><label class="inputLabel"><?php echo __('Filter Results by') ?>:</label></td>
                        <td valign="middle" style="vertical-align: middle;"><input name="keyword" value="<?php echo $keyword?>" type="text" size="30"></td>
                        <td><button id="btnSearch">Search</button></td>
                    </tr>
                </table>
            </form>
            <br class="clearBoth">

            <form name="add2cartForm" id="add2cartForm" action="/shoppingcart/addMany2cart" method="post" enctype="multipart/form-data">
                <div id="productListing">
                    <div class="buttonRow forward"><button id="addToCart"><?php echo __('Add this to my cart') ?></button></div>
                    <br class="clearBoth">

                    <br class="clearBoth">

                    <table id="cat1Table" class="tabTable" border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tbody>
                        <tr class="productListing-rowheading">
                            <th class="productListing-heading" scope="col" id="listCell0-0" align="center" width="20%">Product Image</th>
                            <th class="productListing-heading" scope="col" id="listCell0-1" width="70%">
                                <a href="<?php echo url_for("/product/search".$queryItemName) ?>"
                                    title="Sort products descendingly by Item Name" class="productListing-heading">Item Name</a></th>
                            <th class="productListing-heading" scope="col" id="listCell0-2" align="right" width="10%"><a
                                    href="<?php echo url_for("/product/search".$queryPrice) ?>"
                                    title="Sort products ascendingly by Price" class="productListing-heading">Price</a>
                            </th>
                        </tr>
<!--                        #################################       -->
<!--                        #################################       -->
<!--                        #################################       -->

                <?php
                    $trOddEven = "even";
                    foreach ($cmsProducts as $cmsProduct):
                        $title = $cmsProduct->getProductName() . " #" . $cmsProduct->getProductCode();
                        if ($sf_user->getCulture() == "cn") {
                            $title = $cmsProduct->getProductNameCn() . " #" . $cmsProduct->getProductCode();
                        }

                        if ($trOddEven == "even")
                            $trOddEven = "odd";
                        else
                            $trOddEven = "even";
                ?>

                        <tr class="productListing-<?php echo $trOddEven; ?>">
                            <td class="productListing-data" align="center">
                                <a href="<?php echo url_for("/product/item?id=" . $cmsProduct->getProductId()) ?>">
                                <img src="/uploads/products/<?php echo $cmsProduct->getProductPhoto() ?>" alt="<?php echo $title; ?>" title="<?php echo $title; ?>"
                                    class="listingProductImage" height="177" width="177"></a></td>
                            <td class="productListing-data">
                                <h3 class="itemTitle">
                                    <a href="<?php echo url_for("/product/item?id=" . $cmsProduct->getProductId()) ?>">
                                        <?php echo $title; ?>
                                    </a>
                                </h3>

                                <div class="listingDescription">
                                    <?php echo $cmsProduct->getProductShortDesc() ?>
                                </div>
                                <?php include_component('component', 'fancybox', array('param' => $cmsProduct->getProductId())) ?>
                            </td>
                            <td class="productListing-data" align="right">RM <?php echo number_format($cmsProduct->getPrice(), 2) ?>
                                <br><br><span style="font-size: 14px"> Add:</span>
                                <input name="productId[]" value="<?php echo $cmsProduct->getProductId() ?>" size="4" type="hidden">
                                <input name="cartQuantity[]" value="0" size="4" type="text" class="onlyNumeric">
                                <br><br>
                            </td>
                        </tr>
                <?php endforeach; ?>

<!--                        #################################       -->
<!--                        #################################       -->
<!--                        #################################       -->

                        </tbody>
                    </table>

                    <br class="clearBoth">

                    <div class="buttonRow forward"><button id="addToCart2"><?php echo __('Add this to my cart') ?></button></div>
                    <br class="clearBoth">
                </div>
            </form>
        </div>
        <div class="clear"></div>
    </div>
</td>
</tr>
</tbody>
</table>

</div>